package com.java.common.model;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result implements Serializable {

    private static final long serialVersionUID = 3964491830077754481L;

    private String code;

    private String message;

    private Object data;

    public Result() {

    }

    public Result(String code) {
        this.code = code;
    }

    public Result(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(String code, Object data) {
        this.code = code;
        this.data = data;
    }

    public static Result success() {
        return new Result("200");
    }

    public static Result success(Object data) {
        return new Result("200", data);
    }

    public static Result error(String code, String message) {
        return new Result(code, message);
    }

}
